Component({
  mixins: [],
  data: {
    isDataDone: false,
    dituvalue: 100000,
    ditupao: [
     {
        value: 1110000
     },
     {
        value: 3330000
     },
     {
        value: 6660000
     },
     {
        value: 8880000
     },
     {
        value: 11110000
     }
    ],
    starLine: [10, 0, 0, 0, 0],
    starAniStart: false,
    perc:""
  },
  props: {},
  didMount() {
    this.start();
  },
  didUpdate() {},
  didUnmount() {},
  methods: {

    start(){
      this.setData({ dituvalue: Number(100) })
        this.setData({
          perc: Math.floor(this.data.dituvalue / this.data.ditupao[this.data.ditupao.length - 1].value * 100)
        })
        //计算5角量线条动画相关数据
        let slineAni = [];
        var slineAniLd = [];
        this.data.ditupao.map(v => {
          slineAni.push(v.value)
          slineAniLd.push(0)
        })
        slineAni.map((v, i) => {
          if (this.data.dituvalue >= v) {
            slineAniLd[i] = 1
          }
          else {
            if(i>0){
              slineAniLd[i] = (this.data.dituvalue - slineAni[i - 1]) / (v - slineAni[i - 1])
            }
            else{
              slineAniLd[i] = (this.data.dituvalue) / (slineAni[0])
            }
            
          }
        })
        slineAniLd.map((v, i) => {
          if (v < 0) { slineAniLd[i] = 0 }
        })
        this.setData({ starLine: slineAniLd })
    }

  },
});
